package com.surveillance.DAO;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.surveillance.entities.Surveillant;
import com.surveillance.util.CustomHibernateDaoSupport;

@Repository("SurveillantDAO")
public class SurveillantDao extends BaseDao<Surveillant> {
	
	private String prepareIdsForQuery(String[] ids) {
		String res = "(";
		for (int i = 0; i < ids.length - 1; i++) {
			res += ids[i] + " , ";
		}
		res += ids[ids.length - 1] + ")";
		return res;

	}

	public List getSurveillantByIds(String[] ids) {
		return getHibernateTemplate().find(
				"from Surveillant where id in " + prepareIdsForQuery(ids));
	}

}
